import { get, post, put } from '@/utils/request.js'

// 用户注册
export const registerApi = async data => {
    return await post({
        url: '/api/user/register',
        data
    })
}

// 用户登录
export const loginApi = async data => {
    return await post({
        url: '/api/user/login',
        data
    })
}

// 更新用户信息
export const updateUserInfoApi = async data => {
    return await put({
        url: '/api/user',
        data
    })
}

// 获取用户信息
export const getUserInfoApi = async params => {
    return await get({
        url: '/api/user/profile',
        params
    })
}

// 请求邮箱验证码
export const getEmailCodeApi = async params => {
    return await get({
        url: '/api/user/getMailCode',
        params
    })
}

// 三方登录
export const thirdLoginApi = async params => {
    return await get({
        url: `/api/third/google/callback`,
        params
    })
}

// 修改密码
export const updatePasswordApi = async data => {
    return await put({
        url: '/api/user/change_password',
        data
    })
}
